﻿using FPSO.Models.ViewModel.Controls;
using FPSO.Services;
using FPSO.Services.Impl;
using System;
using System.Windows.Controls;

namespace FPSO.HMI.Controls
{
    /// <summary>
    /// UCBarList.xaml 的交互逻辑
    /// </summary>
    public partial class UCBarListHorizontal : UserControl
    {
        private BarListViewModel viewModel = null;
        private IDataBindingService bindingService = null;

        public UCBarListHorizontal()
        {
            InitializeComponent();

            viewModel = new BarListViewModel();
            DataContext = viewModel;
        }

        public void StartReal()
        {
			//bindingService = new RealDataBindingServiceImpl<BarListViewModel>(SysConfig.PDBConnStr, viewModel);
			bindingService = new RealDataBindingServiceImpl<BarListViewModel>(viewModel);
		}

		public bool IsInitBindingService()
        {
            return bindingService != null;
        }

        public void ReflushUIValues(DateTime currentTime)
        {
            if (bindingService != null)
            {
                bindingService.ReflushData(currentTime);
            }
        }

    }
}
